package cn.chen.thread;

public class ThreadLocalInitialValueTest extends ThreadLocal{
    @Override
    protected Object initialValue() {
        return "我是默认值,get不为null";
    }
}

class Run3{

    public static ThreadLocalInitialValueTest thread1 = new ThreadLocalInitialValueTest();

    public static void main(String[] args) {
        if(thread1.get() == null){
            System.out.println("没有值");
            thread1.set("新值");
        }
        System.out.println(thread1.get());
        System.out.println(thread1.get());
    }
}
